//package com.openlogic.common.datasource.annotation.handler;
//
//import org.noear.solon.core.BeanWrap;
//import org.noear.solon.core.aspect.Interceptor;
//import org.noear.solon.core.aspect.Invocation;
//import org.noear.solon.core.handle.Action;
//import org.noear.solon.core.handle.Context;
//import org.noear.solon.core.handle.Handler;
//import org.noear.solon.core.wrap.MethodWrap;
//
//import com.openlogic.common.core.context.SecurityContextHolder;
//import com.openlogic.common.core.utils.AuthDataScopeUtils;
//import com.openlogic.common.core.utils.HeadersUtils;
//import com.openlogic.common.datasource.annotation.IgnoreTenant;
//
///**
// * @Author: ajie
// * @CreateTime: 2024-08-01 15:34
// */
//public class IgnoreTenantHandler implements Interceptor {
////    @Override
////    public void handle(Context ctx) throws Throwable {
////        Action action = ctx.action();
////        BeanWrap controller = action.controller();
////        // 获取数据权限注解
////        IgnoreTenant superbIgnoreTenant = controller.annotationGet(IgnoreTenant.class);
////        if (superbIgnoreTenant != null) {
////            AuthDataScopeUtils.setIsTenant(superbIgnoreTenant.value());
////        }else {
////        	AuthDataScopeUtils.setIsTenant(true);
////        }
////        // 4.当前动作的执行方法包装
////        MethodWrap method = action.method();
////        IgnoreTenant annotation = method.getAnnotation(IgnoreTenant.class);
////        if (annotation != null) {
////            AuthDataScopeUtils.setIsTenant(annotation.value());
////        }else {
////        	AuthDataScopeUtils.setIsTenant(true);
////        }
////    }
//
//	@Override
//	public Object doIntercept(Invocation inv) throws Throwable {
//		System.out.println("zuhu:"+ SecurityContextHolder.getEnterpriseId());
//		IgnoreTenant annotation = inv.getMethodAnnotation(IgnoreTenant.class);
//		if (annotation != null) {
//            AuthDataScopeUtils.setIsTenant(annotation.value());
//        }else {
//        	AuthDataScopeUtils.setIsTenant(true);
//        }
//		Object invoke = inv.invoke();
//		return invoke;
//	}
//}
